﻿using System.Runtime.Serialization;

namespace Hibiku.Twitter
{
    [DataContract]
    public class AuthorizationResponse
    {
        [DataMember]
        public string UserId { get; private set; }

        [DataMember]
        public string UserName { get; private set; }

        [DataMember]
        public TokenPair AccessTokenPair { get; private set; }

        public bool IsValid
        {
            get { return AccessTokenPair.IsValid && !string.IsNullOrEmpty(UserId) && !string.IsNullOrEmpty(UserName); }
        }

        public AuthorizationResponse(string userId, string userName, TokenPair accessTokenPair)
        {
            UserId = userId;
            UserName = userName;
            AccessTokenPair = accessTokenPair;
        }
    }
}
